const express = require('express');
const serve = express();

serve.get('/api/test/:index', (req, res) => {
  const time = ~~(Math.random() * 1000) + 500;
  setTimeout(() => {
    res.send(`来自第${req.params.index}个Tab的请求返回，用时${time}ms`);
  }, time);
});

const port = 309;

serve.listen(port, () => { console.log('服务开启成功！监听接口：' + port); });
